/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');


/**
 * 自定义组件
 */
window.ModelDataSource = require('./components/data/ModelDataSource');
Vue.use(ModelDataSource);
window.ListDataSource = require('./components/data/ListDataSource');
Vue.use(ListDataSource);

/**
 * Vue Router
 */
import router from './router.js';
/**
 * Vuex
 */
import store from './store';

/**
 * Element-UI
 */
// import ElementUI from 'element-ui';
// Vue.use(ElementUI);

/**
 * VeeValidate
 * Vue表单验证
 */
import zh_CN from 'vee-validate/dist/locale/zh_CN';
import VeeValidate, {Validator}from 'vee-validate';
import VueImgInputer from 'vue-img-inputer';
import vueEventCalendar from 'vue-event-calendar';
import Checkbox from 'vue-material-checkbox';

Vue.use(Checkbox);
Vue.use(vueEventCalendar, {locale: 'zh', color: ' #1ab394'});
Vue.use(VueImgInputer);
// Add locale helper.
// Validator.addLocale(zh_CN);
// Validator.extend('voice', {
//         messages: {
//             zh_CN:field => '音频格式不正确'
//     },
//     validate: value => {
//     return /^(.+?)\.(mp3|wma|wav|amr|MP3|WMA|WAV|AMR)$/.test(value);
// }
// });
// Validator.extend('video', {
//         messages: {
//             zh_CN:field => '视频格式不正确'
//     },
//     validate: value => {
//     return /^(.+?)\.(mp4|MP4)$/.test(value);
// }
// });
// Validator.extend('qq', {
//         messages: {
//             zh_CN:field => '图片格式不正确'
//     },
//     validate: value => {
//     return /^(.+?)\.(jpeg|png|jpg|gif|JPEG|PNG|JPG|GIF)$/.test(value);
// }
// });
// Validator.extend('href', {
//         messages: {
//             zh_CN:field => '请输入正确网址'
//     },
//     validate: value => {
//     return /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/.test(value);
// }
// });
const veeConfig = {
    errorBagName: 'errors', // change if property conflicts.
    delay: 0,
    locale: 'zh_CN',
    messages: null,
    strict: true
};
Vue.use(VeeValidate, veeConfig);
import Vue2Filters from 'vue2-filters';
Vue.use(Vue2Filters);

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 *
 * 全局组件
 */

// register globally
Vue.component('modal', require('./components/others/Modal.vue'));
Vue.component('mobileModal', require('./components/others/MobileModal.vue'));
// Vue.component('modal', require('../../../node_modules/bright-vue-components/src/others/Modal.vue'));
Vue.component('confirm-modal', require('../../../node_modules/bright-vue-components/src/others/ConfirmModal.vue'));
Vue.component('pagination', require('./components/data/Pagination.vue'));
Vue.component('input-text', require('../../../node_modules/bright-vue-components/src/form/InputField.vue'));
Vue.component('vue-table', require('./components/data/Table.vue'));
Vue.component('vue-select-table', require('./components/data/TableSelect.vue'));
Vue.component('input-radio', require('./components/form/InputRadio.vue'));
Vue.component('input-select', require('./components/form/Select.vue'));
Vue.component('input-date', require('../../../node_modules/bright-vue-components/src/form/InputDate.vue'));
Vue.component('input-range-date', require('../../../node_modules/bright-vue-components/src/form/InputDateRange.vue'));
Vue.component('page-decorator', require('../../../node_modules/bright-vue-components/src/others/PageDecorator.vue'));
Vue.component('vue-form', require('../../../node_modules/bright-vue-components/src/form/Form.vue'));
Vue.component('vue-form-item', require('../../../node_modules/bright-vue-components/src/form/FormItem.vue'));
Vue.component('btn-group', require('../../../node_modules/bright-vue-components/src/form/ButtonGroup.vue'));
Vue.component('input-password', require('./components/form/InputPassword.vue'));
Vue.component('wizard-table', require('../../../node_modules/bright-vue-components/src/Wizard.vue'));

Vue.component('gallery-table',require('./components/data/Gallery.vue'));
Vue.component('masonry-table',require('./components/data/MasonryTable.vue'));
Vue.component('message-table', require('./components/data/MessageTable.vue'));
Vue.component('board', require('./components/data/Board.vue'));
Vue.component('time-line', require('./components/data/TimeLine.vue'));
Vue.component('app', require('./app.vue'));


new Vue({
    el: '#app',
    router: router,
    store: store,
    template: '<app/>',
})


